home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Overload Trio 2
/
Shareware Overload Trio Volume 2 (Chestnut CD-ROM).ISO
/
dir26
/
epi601_2.zip
/
FILES07.EXE
/
RSAMPLE.PGM
< prev
next >
Wrap
Text File
|
1994-08-22
|
2KB
|
53 lines
*RSAMPLE.PGM, is a program to take a random sample of
*records in a file. If you want to take a 1/5 sample
*of 75 records, for example, the sample will contain approximately
*15 records. A different sample is taken each time the program runs.
*Note, however that the number of records in a sample may vary widely
*and should be monitored.
READ ? Name of .rec file to sample ?
DEFINE DENOM #### GLOBAL
DEFINE RANNUM ####
CLS
ECHO
ECHO
ECHO This program takes a random sample of records in a file. The
ECHO size of the sample may vary, especially when sampling small
ECHO numbers of records, and you may wish to specify a smaller
ECHO denominator for the sampling fraction than is actually desired
ECHO in order to obtain a large enough sample. When sampling from
ECHO large numbers of records, the random process should produce a
ECHO sample very close to the size expected.
ECHO
ECHO Please specify a denominator for the sampling fraction.
ECHO To select 1 record out of 20 (a 5% sample), for example,
ECHO you should enter 20 as the denominator...
ECHO
ECHO Denominator of sampling fraction:
ECHO (Smaller numbers give larger samples)
IMMEDIATE DENOM = ? Must be an integer (e.g., 3,5,10,20): ?
ECHO
ECHO
*Pick a random integer between 0 and the denominator
RANNUM = RAN (DENOM)
*If the number chosen happens to equal the denominator, select
*the record. On the average, this should happen 1/DENOM of the
*time, giving the desired sample size in a random way.
SELECT RANNUM = DENOM
*Open output file
ERASE RSAMPLE.REC
ROUTE RSAMPLE.REC
WRITE RECFILE NOT DENOM RANNUM
*View results
READ RSAMPLE.REC
LIST
TYPE " The records above are contained in file RSAMPLE.REC."
TYPE " If you wish to save the sample, please rename or copy "
TYPE " RSAMPLE.REC before running RSAMPLE.PGM again."
? Press any key to QUIT ?
QUIT